package com.hl.controller.huiyuan;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.hl.domain.LiliShopMember;
import com.hl.service.HuishouMemberService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 回收站Controller
 * 
 * @author ruoyi
 * @date 2025-08-06
 */
@RestController
@RequestMapping("/huishou")
public class HuishouMemberController extends BaseController
{
    @Autowired
    private HuishouMemberService liliShopMemberService;

    /**
     * 查询回收站列表
     */
    @RequiresPermissions("huiyuan:huishou:list")
    @GetMapping("/list")
    public TableDataInfo list(LiliShopMember liliShopMember)
    {
        startPage();
        List<LiliShopMember> list = liliShopMemberService.selectHuishouMemberList(liliShopMember);
        return getDataTable(list);
    }

    /**
     * 导出回收站列表
     */
    @RequiresPermissions("huiyuan:huishou:export")
    @Log(title = "回收站", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LiliShopMember liliShopMember)
    {
        List<LiliShopMember> list = liliShopMemberService.selectHuishouMemberList(liliShopMember);
        ExcelUtil<LiliShopMember> util = new ExcelUtil<LiliShopMember>(LiliShopMember.class);
        util.exportExcel(response, list, "回收站数据");
    }

    /**
     * 获取回收站详细信息
     */
    @RequiresPermissions("huiyuan:huishou:query")
    @GetMapping(value = "/{memberId}")
    public AjaxResult getInfo(@PathVariable("memberId") String memberId)
    {
        return success(liliShopMemberService.selectHuishouMemberByMemberId(memberId));
    }

    /**
     * 新增回收站
     */
    @RequiresPermissions("huiyuan:huishou:add")
    @Log(title = "回收站", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LiliShopMember liliShopMember)
    {
        return toAjax(liliShopMemberService.insertHuishouMember(liliShopMember));
    }

    /**
     * 修改回收站
     */
    @RequiresPermissions("huiyuan:huishou:edit")
    @Log(title = "回收站", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LiliShopMember liliShopMember)
    {
        return toAjax(liliShopMemberService.updateHuishouMember(liliShopMember));
    }

    /**
     * 删除回收站
     */
    @RequiresPermissions("huiyuan:huishou:remove")
    @Log(title = "回收站", businessType = BusinessType.DELETE)
	@DeleteMapping("/{memberIds}")
    public AjaxResult remove(@PathVariable String[] memberIds)
    {
        return toAjax(liliShopMemberService.deleteHuishouMemberByMemberIds(memberIds));
    }
}
